package com.zm.sgin.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.List;

@Component
@Data
@ConfigurationProperties(prefix = "sgin")
@AllArgsConstructor
@NoArgsConstructor
public class SginProperties {
    boolean enable;
    String userTable;
    String usernameColumn;
    String passwordColumn;
    String emailColumn;
    String userClass;
    String sessionKey;
    String loginHtml;
    List<String> urls;
    String encryption;

    Class userClassObject;

    @PostConstruct
    void init() throws ClassNotFoundException {
        if (userClass!=null){
            this.userClassObject = Class.forName(userClass);
        }
    }
}
